package com.mybatisflex.demo.listener;

import com.mybatisflex.annotation.AbstractUpdateListener;
import com.mybatisflex.demo.entity.Card;
import lombok.extern.slf4j.Slf4j;

import java.time.LocalDateTime;

/**
 * @author 王帅
 * @since 2023-07-18
 */
@Slf4j
public class CardUpdateListener extends AbstractUpdateListener<Card> {

    @Override
    public Class<Card> supportType() {
        return Card.class;
    }

    @Override
    public void doUpdate(Card card) {
        log.info("执行 CardUpdateListener 中的 doUpdate 方法。");
        card.setUpdateTime(LocalDateTime.now());
    }

    @Override
    public int order() {
        return 1;
    }

}